<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
    <title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../scripts/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
<script type="text/javascript" src="../scripts/plugins/jquery-1.7.1.js"></script>
<script type="text/javascript" src="../scripts/ztree/js/jquery.ztree.core-3.1.js"></script>
<script type="text/javascript">

	var zNodes =[
  	{id: 1,
    pId: 0,
    name: "客户管理",
    open: true,
    url: "admin/open.action",
    target:"frmright"
    },
   
  	{id: 2,
    pId: 0,
    name: "商品管理",
    open: true,
    url: "admin/open.action",
    target:"frmright"
    },
  	{id: 3,
    pId: 0,
    name: "商品类别管理",
    open: true,
    url: "admin/open.action",
    target:"frmright"
    },
   
  	{id: 4,
    pId: 0,
    name: "订单管理",
    open: true,
    url: "admin/order/order.action",
    target:"frmright"
    },
   
  	{id: 5,
    pId: 1,
    name: "客户列表",
    open: true,
    url: "admin/customer/list.action",
    target:"frmright"
    },
   
  	{id: 32,
    pId: 13,
    name: "新增负责人",
    open: true,
    url: "admin/agent/add.action",
    target:"frmright"
    },
   
  ];

	var setting = {
		data: {
			simpleData: {
				enable: true
			}
		}, 
		callback: {
			onClick: onClick
		}
	};
	
	function onClick(e,treeId, treeNode) {
		var zTree = $.fn.zTree.getZTreeObj("treeDemo");
		var defaultUrl = "/admin/open.action";
		if ((treeNode.isParent) && (treeNode.url == defaultUrl)) {
			zTree.expandNode(treeNode, true, true, true);
		}
	}
	
	$(document).ready(function(){
		$.fn.zTree.init($("#treeDemo"), setting, zNodes);
	});
</script>
</head>
<body>
<div style="text-align:center;">
	<div>
		<ul id="treeDemo" class="ztree"></ul>
	</div>
</div>
</body>
</html>